<template>
  <div class="affairs-evaluate">
    <el-form :model="formData" ref="form" :rules="rules" label-width="120px">
      <div class="form-section">
        <h3>满意度评价</h3>
        
        <el-form-item label="处理效率" prop="efficiency">
          <el-rate
            v-model="formData.efficiency"
            :colors="colors">
          </el-rate>
        </el-form-item>

        <el-form-item label="处理质量" prop="quality">
          <el-rate
            v-model="formData.quality"
            :colors="colors">
          </el-rate>
        </el-form-item>

        <el-form-item label="服务态度" prop="attitude">
          <el-rate
            v-model="formData.attitude"
            :colors="colors">
          </el-rate>
        </el-form-item>

        <el-form-item label="总体评价" prop="overall">
          <el-rate
            v-model="formData.overall"
            :colors="colors">
          </el-rate>
        </el-form-item>

        <el-form-item label="评价意见" prop="comment">
          <el-input
            type="textarea"
            v-model="formData.comment"
            :rows="4"
            placeholder="请输入评价意见">
          </el-input>
        </el-form-item>
      </div>

      <div class="form-actions">
        <el-button @click="prevStep">上一步</el-button>
        <el-button type="primary" @click="submitForm">提交</el-button>
      </div>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'AffairsEvaluate',
  data() {
    return {
      formData: {
        efficiency: 0,
        quality: 0,
        attitude: 0,
        overall: 0,
        comment: ''
      },
      colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
      rules: {
        efficiency: [{ required: true, message: '请评价处理效率', trigger: 'change' }],
        quality: [{ required: true, message: '请评价处理质量', trigger: 'change' }],
        attitude: [{ required: true, message: '请评价服务态度', trigger: 'change' }],
        overall: [{ required: true, message: '请进行总体评价', trigger: 'change' }]
      }
    }
  },
  methods: {
    prevStep() {
      this.$emit('prev-step')
    },
    submitForm() {
      this.$refs.form.validate(valid => {
        if (valid) {
          this.$emit('next-step', this.formData)
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.affairs-evaluate {
  .form-section {
    margin-bottom: 30px;
    
    h3 {
      margin: 0 0 20px;
      padding-left: 10px;
      border-left: 4px solid #409EFF;
      font-size: 18px;
      font-weight: 500;
      color: #303133;
    }
  }

  .form-actions {
    text-align: center;
    margin-top: 40px;
  }
}
</style> 